-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Elasticsearch query runner #4391
Conversation
The new elasticsearch query runner is split into three: - A runner supporting the newest versions of ES, aggregation, nested aggregations and nested fields. - A runner for the SQL OpenDistro flavor - A runner for the SQL X-Pack flavor Fixes #4293
Thanks for posting this PR, it is an awesome addition to redash. I made a try with this change using ElasticSearch 6.8.2. Regardless what input type I choose (ElasticSearch2 or XPackSQLElasticSearch) the UI Reports 'Schema refresh failed.' when I try to query the data source. The original ElasticSearch datasource works well with this ES Instance. I do not find any error in the error logs, even though the log-level is set to DEBUG:
GET /api/data_sources/3/schema returns: Any advice how to resolve this problem? |
for index_name in mappings_data: | ||
mappings[index_name] = {} | ||
index_mappings = mappings_data[index_name] | ||
_parse_properties('', index_mappings['mappings']['properties']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to iterate through on all the documents within the index to parse the properties.
for m in index_mappings.get("mappings", {}):
_parse_properties('', index_mappings['mappings'][m]['properties'])
For details see: #4391 (comment)
def _parse_results(cls, result_fields, raw_result): | ||
error = raw_result.get('error') | ||
if error: | ||
raise Exception(error['reason']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into this branch and it eat the original exception: error was a string for me, which is not addressable by 'reason'.
Raising the error solved the problem: raise Exception(error)
query, url, result_fields = self._build_query(query) | ||
response, error = self.get_response( | ||
url, | ||
http_method='post', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POST method is only allowed with generic ElasticSearch queries and not with SQL.
For SQL queries PUT has to be set, which is not compatible with the generic queries.
Therefore this field should be factored into a variable which is settable per query type.
Hi, can i work on this? I also need that feature :) |
How can i use this feature?I am confused. |
These changes (and commit history) are incorporated into #5794. Closing here. |
What type of PR is this? (check all applicable)
Description
New implementation of the Elasticsearch query runner to overcome the limitations of the previous one.
The new runner is split into three:
Related Tickets & Documents
Fixes #4293